#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QMenuBar* menuBar = this->menuBar();
    this->setMenuBar(menuBar);

    QMenu* menu1 = new QMenu("保存");
    QMenu* menu2 = new QMenu("编辑");

    menuBar->addMenu(menu1);
    menuBar->addMenu(menu2);

    // 设置菜单图标
    menu1->setIcon(QIcon(":/save.png"));
    menu2->setIcon((QIcon(":/edit.png")));

    QAction* act1 = new QAction("保存");
    QAction* act2 = new QAction("编辑");

    // 设置菜单项图标
    act1->setIcon(QIcon(":/save.png"));
    act2->setIcon(QIcon(":/edit.png"));

    menu1->addAction(act1);
    menu1->addAction(act2);
}

MainWindow::~MainWindow()
{
    delete ui;
}

